package ANDROID_LIFECYCLE_SV_FRAGMENTINJ;

public class Fixed {
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final String initialFragment = getIntent().getStringExtra("EXTRA_SHOW_FRAGMENT");
        if (!isValidFragment(initialFragment)) {
            throw new IllegalArgumentException("Invalid fragment for this activity");
        }
        final Fragment f = Fragment.instantiate(this, initialFragment, null);
        final FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
        transaction.replace(11, f);
        transaction.commitAllowingStateLoss();
    }

    public boolean isValidFragment(final String name) {
        //validate here …
    }
}
